package com.hpin.mlxteacher.child;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.hpin.mlxteacher.R;
import com.hpin.mlxteacher.adapter.ClassifyAdapter;
import com.hpin.mlxteacher.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * 工作列表页面
 * Created by Aaron on 2015/7/27.
 */
public class WorkActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_work);

        initWidget();
    }

    private void initWidget() {

        TextView tv_title = (TextView) findViewById(R.id.tv_title);
        ImageView iv_left = (ImageView) findViewById(R.id.iv_left);

        tv_title.setText(getResources().getString(R.string.work));

        ListView lv_works = (ListView) findViewById(R.id.lv_works);

        List<String> str = new ArrayList<String>();
        str.add(getResources().getString(R.string.attendance));
        str.add(getResources().getString(R.string.baby_life_record));
        ClassifyAdapter adapter = new ClassifyAdapter(this, str);
        lv_works.setAdapter(adapter);

        lv_works.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch (position) {

                    case 0://考勤

                        Intent intent = new Intent(WorkActivity.this, AttendanceActivity.class);
                        startActivity(intent);

                        break;

                    case 1: //宝宝生活记录

                        Intent bIntent = new Intent(WorkActivity.this, LifeRecordActivity.class);
                        startActivity(bIntent);

                        break;

                }
            }
        });


        iv_left.setOnClickListener(this);
    }

    @Override
    public void widgetClick(View v) {

        switch (v.getId()) {
            case R.id.iv_left:
                finish();
                break;
        }
    }
}
